<?php
// $Id$

/**
 * Controller_Category 控制器
 */
class Controller_Category extends Controller_Abstract
{

	function actionIndex() {
        // 为 $this->_view 指定的值将会传递数据到视图中
		# $this->_view['text'] = 'Hello!';
	}
	
	function actionList(){
		$this->_view['category'] = Categories::find(' ID = ?', $this->_context->cid )->query();	
		// 分页查询
		$page = intval($this->_context->page);
		if ($page < 1) $page = 1;
		// 构造查询对象	
		$select = $this->_view['posts'] = Posts::find(' category_id = ?', $this->_context->cid)->Order(' ID DESC')->limitPage($page,10);
		// 将分页信息和查询到的数据传递到视图
		$this->_view['pagination'] = $select->getPagination();
		$this->_view['posts'] = $select->getAll();
			
		
	}
	
	
	
	
	
}


